fix(agent_orchestration): Unbounded timeout for delegation tools — delegate_tools_agent, run_code (#4734)#4741
Merged
senamakel merged 1 commit intoJul 14, 2026
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughArchetypeDelegationTool now opts out of the inherited global tool timeout by returning ChangesDelegation timeout handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
c408115 to
5df7911
Compare
…yhumansai#4734) ArchetypeDelegationTool synthesizes delegate_tools_agent (tools_agent) and run_code (code_executor). It defaulted to ToolTimeout::Inherit = the global 120s per-tool cap, so any delegated sub-agent run exceeding two minutes was hard-killed and truncated (Sentry TAURI-RUST-K29: 1236 events / 71 users; TAURI-RUST-8HB: 755 / 51). The child bounds its own lifetime via max_iterations, the run cancellation token, and each inner tool's timeout, so override timeout_policy -> Unbounded, matching spawn_parallel_agents (tinyhumansai#4686) and the long-running scripting tools. Adds a unit test asserting the override.
5df7911 to
3f84918
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
delegate_tools_agent,run_code, and any other archetype-delegate tool) now opt out of the global 120s per-tool wall-clock, so a sub-agent run that legitimately takes longer than two minutes is no longer hard-killed mid-flight.TAURI-RUST-K29(delegate_tools_agent, 1236 events / 71 users) andTAURI-RUST-8HB(run_code, 755 events / 51 users).Problem
Both
delegate_tools_agentandrun_codeare synthesized by the same type,ArchetypeDelegationTool. It never overrodetimeout_policy(), so it inheritedToolTimeout::Inherit= the global per-tool cap (tool_timeout::DEFAULT_TIMEOUT_SECS = 120). Every tool call is wrapped intokio::time::timeout(deadline, exec), so a delegation whose sub-agent runs past 120s was hard-killed at exactly 120.000s and truncated — surfacing astool '<name>' timed out after 120 seconds. The delegated agents are internally bounded (theiragent.tomlmax_iterations, the run cancellation token, and each inner tool's own timeout), so the 120s cap doesn't protect against runaway work — it just truncates legitimate long-running delegation.The sibling
spawn_parallel_agentstool had this exact bug fixed in #4686 (timeout_policy -> Unbounded); the long-running scripting tools (shell,node_exec,npm_exec) are already Unbounded-by-default.ArchetypeDelegationToolwas simply missed.Solution
Override
timeout_policy() -> ToolTimeout::UnboundedonArchetypeDelegationTool, mirroring #4686. The child agent governs its own lifetime, so the delegation primitive should not impose the single-tool wall-clock. Adds a unit test asserting the override (mirrorsspawn_parallel_agents_tests).Scope is deliberately narrow:
SkillDelegationTool(→integrations_agent, quick Composio actions) and the baseDelegateToolroute to short-lived agents and are intentionally left on the default — no speculative widening.RCA-vs-suppress: Bucket = real-defect (a wrong timeout policy truncating internally-bounded work). This corrects the policy; it is not a suppression.
Submission Checklist
timeout_policy() == Unbounded; existingArchetypeDelegationTooltests cover the delegation happy/blank-prompt pathscargo-llvm-cov+diff-cover --compare-branch=upstream/main: 100% on changed lines (7/7)N/A: behaviour-only reliability change (no feature row)## Related—N/AN/A: internal tool-timeout policyCloses #NNNin## RelatedImpact
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/4734-delegation-tool-timeout(rebased onto currentmain, past the fix(tests): restore test-module imports broken by recent refactors #4759 libtest fix)Validation Run
pnpm --filter openhuman-app format:check— N/A (noapp/changes)pnpm typecheck— N/A (no TS changes)delegation_opts_out_of_the_global_tool_timeout— passes (test result: ok. 1 passed)cargo fmt --checkclean,cargo check --libclean,cargo clippy --libclean on the changed fileBehavior Changes
Parity Contract
spawn_parallel_agentspattern exactly.Duplicate / Superseded PR Handling
Summary by CodeRabbit